package cn.com.cabinet.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.cabinet.web.entity.CabinetApplication;

public interface CabinetApplicationDao extends JpaRepository<CabinetApplication, Long>,JpaSpecificationExecutor<CabinetApplication>{

	/**
	 * 通过申请状态获取申请列表
	 * @param page
	 * @param limit
	 * @return
	 */
	@Query(nativeQuery=true,value="select * from ict_cabinet_application where applicationMark=?1 limit ?2,?3")
	public List<CabinetApplication> getCabinetApplicationByMark(int applicationMark,Integer page,Integer limit);
	/**
	 * 通过申请状态获取申请总数
	 * @param applicationMark
	 * @return
	 */
	@Query(nativeQuery=true,value="select count(*) from ict_cabinet_application where applicationMark=?1")
	public int getCabinetApplicationCountByMark(int applicationMark);
	
}
